<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Hyphenates a word</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ps-hyphenate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ps_hyphenate</h1>
  <p class="verinfo">(PECL ps &gt;= 1.1.1)</p><p class="refpurpose"><span class="refname">ps_hyphenate</span> &mdash; <span class="dc-title">Hyphenates a word</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ps-hyphenate-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ps_hyphenate</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$text</code></span>
   ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   Hyphenates the passed word. <span class="function"><strong>ps_hyphenate()</strong></span> evaluates the
   value hyphenminchars (set by <span class="function"><a href="ps_set_value.html" class="function">ps_set_value()</a></span>) and
   the parameter hyphendict (set by <span class="function"><a href="ps_set_parameter.html" class="function">ps_set_parameter()</a></span>).
   hyphendict must be set before calling this function.
  </p>
  <p class="para">
   This function requires the locale category LC_CTYPE to be set properly.
   This is done when the extension is initialized by using the environment
   variables. On Unix systems read the man page of locale for more information.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ps-hyphenate-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">psdoc</code></dt>

     <dd>

      <p class="para">
       Resource identifier of the postscript file
       as returned by <span class="function"><a href="ps_new.html" class="function">ps_new()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">text</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">text</code> should not contain any non alpha
       characters. Possible positions for breaks are returned in an array of
       interger numbers. Each number is the position of the char in 
       <code class="parameter">text</code> after which a hyphenation can take place.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ps-hyphenate-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An array of integers indicating the position of possible breaks in
   the text  或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ps-hyphenate-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4227">
    <p><strong>Example #1 Hyphennate a text</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$word&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Koordinatensystem"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$psdoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ps_new</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">ps_set_parameter</span><span style="color: #007700">(</span><span style="color: #0000BB">$psdoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"hyphendict"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"hyph_de.dic"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$hyphens&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ps_hyphenate</span><span style="color: #007700">(</span><span style="color: #0000BB">$psdoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$word</span><span style="color: #007700">);<br />for(</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$word</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$word</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">];<br />&nbsp;&nbsp;if(</span><span style="color: #0000BB">in_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$hyphens</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"-"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">ps_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$psdoc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Ko-ordi-na-ten-sys-tem
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ps-hyphenate-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    
    <li class="member"><span class="function"><a href="ps_show_boxed.html" class="function" rel="rdfs-seeAlso">ps_show_boxed()</a> - Output text in a box</span></li>
    <li class="member">locale(1)</li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>